home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1999 / MacHack 1999.toast / The Hacks / MACtive Desktop / Source / Headers / DCon.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-06  |  1.1 KB  |  37 lines  |  [TEXT/CWIE]

  1. #ifndef _DCON_
  2. #define _DCON_
  3.  
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7.  
  8.  
  9. #define DCON_ASSERTS    1
  10.  
  11.  
  12. void dprintf(char *env,char *format,...);
  13.  
  14.  
  15. #if DCON_ASSERTS
  16. #define dAssertPrint(condition)                dprintf(NULL,"Assert failed: " condition "  %s:%d\n",__FILE__,__LINE__)
  17. #define dAssertIfTrue(condition)            ((condition) ? dAssertPrint(#condition) : ((void)0))
  18. #define dAssertIfFalse(condition)            ((condition) ? ((void)0) : dAssertPrint(#condition))
  19. #define dAssert(condition)                    dAssertIfFalse(condition)
  20. #define if_dAssertIfTrue(condition)            if ((condition) ? (dAssertPrint(#condition),true) : false)
  21. #define if_dAssertIfFalse(condition)        if ((condition) ? true : (dAssertPrint(#condition),false))
  22. #else
  23. #define dAssertPrint(condition)                ((void)0)
  24. #define dAssertIfTrue(condition)            ((condition) ? ((void)0) : ((void)0))
  25. #define dAssertIfFalse(condition)            ((condition) ? ((void)0) : ((void)0))
  26. #define dAssert(condition)                    dAssertIfFalse(condition)
  27. #define if_dAssertIfTrue(condition)            if (condition)
  28. #define if_dAssertIfFalse(condition)        if (condition)
  29. #endif
  30.  
  31.  
  32. #ifdef __cplusplus
  33. }
  34. #endif
  35.  
  36. #endif /* _DCON_ */
  37.